import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;


public class ThreeParams extends HttpServlet {
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8;");
        response.setCharacterEncoding("UTF-8");//浏览器提交到后台时对提交的数据设置编码
        request.setCharacterEncoding("UTF-8");//后台发送数据到浏览器时对对于发送数据，设置编码。

        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<body>");
        out.println("<h1>提交成功！</h1>");
        out.println("用户名：");
        out.println(request.getParameter("gr1" ) +"<br>");
        out.println("邮箱：");
        out.println(request.getParameter("gr2") +"<br>");
        out.println("性别：");
        out.println(request.getParameter("gr3") +"<br>");
        out.println("爱好：");
        out.println(request.getParameter("gr4") +"<br>");
        out.println("</body>");
        out.println("</html>");
        out.close();
    } protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }
}
